import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;
import java.util.Map.Entry;

import name.luojun.DBhelper.SimpleTableManager;
import name.luojun.DBhelper.TableManager;
import name.luojun.DBhelper.iface.UpgradeSupport;
import name.luojun.DBhelper.model.TableVO;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ConnectionCallback;
import org.springframework.jdbc.core.StatementCallback;
import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcDaoSupport;
@SuppressWarnings("unused")
public class test extends NamedParameterJdbcDaoSupport implements Ifacel {
	/**
	 * @param args
	 * @throws Exception
	 */
	public static void main2(String[] args) throws Exception {
		ApplicationContext ctx = new ClassPathXmlApplicationContext("config-main-mysql.xml");
		Map<String, UpgradeSupport> beans = ctx.getBeansOfType(UpgradeSupport.class);
		for (Entry<String, UpgradeSupport> en : beans.entrySet()) {
			//en.getValue().createBackFile();
		}
		SimpleTableManager stm = (SimpleTableManager) ctx.getBean("tbm");
		String[] tables = "AUD_salogger,DSF_PCSN_INFO".split(",");
		for (String str : tables) {
			String result = SimpleTableManager.tableToXml(stm.getTableFromDB(str));
			System.out.println(result);
		}
		// TableManager tbm = (TableManager) ctx.getBean("tbm");
		// TableVO t = tbm.getTableFromDB("DSF_PCSN_INFO");
		// System.out.println(TableManager.tableToXml(t));
		// Ifacel o = (Ifacel) ctx.getBean("testDao");
		// o.dotest();
	}
	public static void main(String[] args) {
		Number a = new BigDecimal(100);
		System.out.println(a instanceof Number);
		System.out.println(a.intValue());
		System.out.println(System.currentTimeMillis());
	}
	@Override
	public void dotest() {
		String sql = "select count(*) from USERTABLE";
		String insert = "insert into usertable (id, name, password) values (USER_ID_SEQ.nextval, 'bbb', 'cccc')";
		int count1 = this.getJdbcTemplate().queryForInt(sql);
		System.out.println(count1);
		// this.getNamedParameterJdbcTemplate().update(insert, null);
		int count2 = this.getJdbcTemplate().queryForInt(sql);
		System.out.println(count2);
	}
}
